# -*- coding: utf-8 -*-
"""
Created on Wed Sep 29 13:23:53 2021

@author: think
"""

import numpy as np



a = input()
b = input()

A = []
B = []

for i in range(16):
    A.extend(list('{:0>4b}'.format(int(a[i], 16))))
    B.extend(list('{:0>4b}'.format(int(b[i], 16))))

A = np.array(A)
B = np.array(B)
C = (A == B)
print(sum(C == False))